<style>
    .uplaod-card{
        border-style: solid;
        border-width: 1px;
        border-color: #e6e6e6;
    }
</style>
<div id="common-form-view" class="common-form-view" style="padding: 15px;"></div>
<script id="tplForm" type="text/html">
    <form id="{{d.id}}" lay-filter="{{d.id}}" class="layui-form layui-form-pane">
        {{# layui.each(d.items, function(index, item){ }}

        {{# if(item.code == 2 || item.code == 6){ item.pane = "pane"; } }}
        {{# if(item.code == 5 || item.code == 8 || item.code == 9){ item.class = "layui-form-text"; } }}
        <div class="layui-form-item {{item.class}}" {{= item.pane}}>
            {{# if(item.code == 11){ }}
                {{# if((typeof item.type) == "undefined" || item.type == "radio"){ }}
                    <label class="layui-form-label">
                        {{item.title}}
                    </label>
                    <!--树形下拉选择器-->
                    <div class="layui-input-block">
                        <input type="text" name="{{ item.name}}" id="tree-select-{{ item.id ? item.id : item.name }}"
                               lay-filter="{{ item.filter ? item.filter : item.name}}" class="layui-input">
                    </div>
                {{# }else{ }}
                    <div class="layui-inline">
                        <label class="layui-form-label">{{item.title}}</label>
                        <div class="layui-input-inline">
                            <input type="text" name="{{ item.name}}" id="tree-select-{{ item.id ? item.id : item.name }}"
                                   lay-filter="{{ item.filter ? item.filter : item.name}}" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline" style="width: 350px;">
                        <div class="layui-input-inline" style="width: 350px;" id="tree-selected-{{ item.id ? item.id : item.name }}-view">

                        </div>
                    </div>
                {{# }  }}
            {{# }else{ }}
                <label class="layui-form-label">
                    {{item.title}}
                    {{# if(item.code == 8){  }}
                    <span id="{{ item.name}}" style="display: block; float: right;" class="common-form-icon">
                        <i class="layui-icon layui-icon-upload"></i>上传
                    </span>
                    {{# }  }}
                </label>
                <div class="layui-input-block">

                    {{# if(item.code == 1){ }}
                    <!-- text number phone email password -->
                    <input name="{{ item.name}}" placeholder="{{ item.placeholder  ? item.placeholder : '' }}"
                           type="{{ item.type}}" class="layui-input" {{= (item.attr) ? item.attr : "" }}/>
                    {{# } }}

                    {{# if(item.code == 2){ }}
                    <!-- 复选框/单选框  -->
                    {{#  layui.each(item.options, function(index, option){ }}
                        {{# if(option.value != -1) { }}
                            <input name="{{ item.name}}" type="{{ option.type}}" value="{{ option.value}}"
                                title="{{ option.title}}" autocomplete="off"/>
                        {{# } }}
                    {{# }) }}
                    {{# } }}

                    {{# if(item.code == 3){ }}
                    <!-- 下拉框 -->
                    <select name="{{ item.name}}" id="{{ item.id ? item.id : item.name }}"
                            {{# if(item.search){ }} lay-search="" {{# } }}
                            lay-filter="{{ item.filter ? item.filter : item.name}}">
                        {{#  layui.each(item.options, function(index, option){ }}
                            {{# if(option.value != -1) { }}
                                <option value="{{option.value}}">{{ option.title}}</option>
                            {{# } }}
                        {{# }) }}
                    </select>
                    {{# } }}

                    {{# if(item.code == 4){ }}
                    <!-- 日期选择 -->
                    <input type="text" name="{{ item.name}}" placeholder="{{ item.placeholder  ? item.placeholder : '' }}"
                           id="{{ item.id ? item.id : item.name }}" autocomplete="off" class="layui-input"/>
                    {{# } }}


                    {{# if(item.code == 5){ }}
                    <!-- 文本域 -->
                    <textarea type="text" name="{{ item.name}}" placeholder="{{ item.placeholder  ? item.placeholder : '' }}"
                              id="{{ item.id ? item.id : item.name }}" maxlength="120" {{= (item.attr) ? item.attr : "" }}
                    autocomplete="off" class="layui-textarea" />
                    {{# } }}

                    {{# if(item.code == 6){ }}
                    <!-- 开关 -->
                    <input lay-filter="{{ item.filter}}" type="checkbox" name="{{ item.name}}" d="{{ item.id ? item.id : item.name }}"
                           lay-text="{{item.text}}" lay-skin="switch">
                    {{# } }}

                    {{# if(item.code == 7){ }}
                    <!--下拉多选-->
                    <div name="{{ item.name}}" xm-select="{{ item.name}}" id="{{ item.id ? item.id : item.name }}"></div>
                    <!-- <select name="{{ item.name}}" xm-select="{{ item.name}}" id="{{ item.id ? item.id : item.name }}" {{= (item.attr) ? item.attr : "" }}>
                    {{#  layui.each(item.options, function(index, option){ }}
                        {{# if(option.value > 0 || option.value != '') { }}
                            <option value="{{option.value}}">{{ option.title}}</option>
                        {{# } }}
                    {{# }) }}
                    </select> -->
                    {{# } }}

                    {{# if(item.code == 8){ }}
                    <!--图片影音文件上传组件-->
                    <div class="layui-card uplaod-card">
                        <input id="input-{{ item.name}}" multiple="multiple" name="input-{{ item.name}}"
                               style="display: none;" data-len="{{ item.len ? item.len : 12 }}"
                               type="file" class="layui-input"/>

                        <div class="layui-card-body" id="layui-upload-{{item.name}}-list" style="height: 120px; overflow-y:scroll;">

                        </div>
                    </div>
                    {{# } }}
                    {{# if(item.code == 10){ }}
                    <!--文件上传组件-->
                    <div class="layui-card">
                        <input id="input-file-{{ item.name}}" multiple="multiple" name="input-file-{{ item.name}}"
                               style="display: none;" data-len="{{ item.len ? item.len : 12 }}"
                               type="file" class="layui-input"/>

                        <div class="layui-card-body" id="layui-upload-file-{{item.name}}-list" style="height: 120px; overflow-y:scroll;">

                        </div>
                    </div>

                    {{# } }}

                    {{# if(item.code == 9){ }}
                    <!--编辑器-->
                    <textarea id="edit-{{ item.name}}" name="{{ item.name}}" style="display: none;"></textarea>
                    {{# } }}

                    {{# if(item.code == 12){ }}
                    <!--自动补全-->
                    <input type="text" id="{{ item.id ? item.id : item.name }}" name="{{item.name }}"
                           autocomplete="off" placeholder="{{ item.placeholder  ? item.placeholder : '' }}"
                           class="layui-input" />
                    {{# } }}
                </div>
            {{# }  }}

        </div>
        {{#  }); }}

    </form>
</script>
